﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>环境监测管理系统</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link href="css/StyleSheet.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="js/my.js"></script>
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	
	
	<script type ="text/javascript">

	Ext.onReady(function()
	{
		
		Ext.BLANK_IMAGE_URL="../ext/resources/images/default/s.gif";
		var top = new Ext.Panel({
				region : 'north',
			//	title : "标题",
				height : 56,
				//margins:'0 0 0 0',
				border : false,
				html:'<iframe id=topIframe scrolling="no"  width="100%" height="100%"   frameborder=0 src="top.jsp"></iframe>'
				//html:""
			});

               
          var root_logtype = new Ext.tree.TreeNode({text:"所有类型",iconCls:"me-iconCls",expanded:true,singleClickExpand:true});		
						
			var tn_group = new Ext.tree.TreeNode({text:"组管理",url:"group.htm",iconCls:"me-iconCls"});
			var tn_user = new Ext.tree.TreeNode({text:"用户管理",url:"user.htm",iconCls:"me-iconCls"});
			var tn_app = new Ext.tree.TreeNode({text:"现场程序管理",url:"app.htm",iconCls:"me-iconCls"});
			var tn_channel = new Ext.tree.TreeNode({text:"通道管理",url:"channel.htm",iconCls:"me-iconCls"});
			var tn_comport = new Ext.tree.TreeNode({text:"串口管理",url:"comport.htm",iconCls:"me-iconCls"});
			var tn_curr_data = new Ext.tree.TreeNode({text:"实时数据",url:"curr_data.htm",iconCls:"me-iconCls"});
			//var tn_channelInfo = new Ext.tree.TreeNode({text:"通道数据",url:"channelInfo.htm",iconCls:"me-iconCls"});
			var tn_factor = new Ext.tree.TreeNode({text:"因子管理",url:"factor.htm",iconCls:"me-iconCls"});
			var tn_function = new Ext.tree.TreeNode({text:"函数管理",url:"function.htm",iconCls:"me-iconCls"});
			var tn_module= new Ext.tree.TreeNode({text:"模块管理",url:"module.htm",iconCls:"me-iconCls"});
			var tn_moduletype= new Ext.tree.TreeNode({text:"模块类型管理",url:"moduletype.htm",iconCls:"me-iconCls"});
			var tn_unit= new Ext.tree.TreeNode({text:"单位管理",url:"unit.htm",iconCls:"me-iconCls"});
			
			var tb_rulemanager= new Ext.tree.TreeNode({text:"系统管理",iconCls:"me-iconCls",singleClickExpand:true});
			var tb_datamanager= new Ext.tree.TreeNode({text:"数据管理",iconCls:"me-iconCls",singleClickExpand:true});
			var tb_paramanager= new Ext.tree.TreeNode({text:"参数管理",iconCls:"me-iconCls",singleClickExpand:true});
			var tb_devmanager = new Ext.tree.TreeNode({text:"设备管理",iconCls:"me-iconCls",singleClickExpand:true});
		
		tb_rulemanager.appendChild([tn_user]);
		tb_rulemanager.appendChild([tn_group]);
		
		//tb_datamanager.appendChild([tn_channelInfo]);
		tb_datamanager.appendChild([tn_curr_data]);
		

		tb_paramanager.appendChild([tn_moduletype]);
		tb_paramanager.appendChild([tn_factor]);
		tb_paramanager.appendChild([tn_function]);
		
		tb_devmanager.appendChild([tn_unit]);
		tb_devmanager.appendChild([tn_app]);
		tb_devmanager.appendChild([tn_comport]);
		tb_devmanager.appendChild([tn_module]);
		tb_devmanager.appendChild([tn_channel]);
		
		root_logtype.appendChild(tb_datamanager);
		root_logtype.appendChild(tb_paramanager);
		root_logtype.appendChild(tb_devmanager);	
		root_logtype.appendChild(tb_rulemanager);
						
			
		var left = new Ext.tree.TreePanel({
				region : 'west',
				id:"main_tree",
				width:200,	
				title:'菜单导航',
				//dataUrl:"Json/TAuthAction!listrole",	
				//loader:new Ext.tree.TreeLoader({baseParams{a:1,b:2,c:3},dataUrl:"Json/TAuthAction!list"}),
				border : true,
				collapsible: true,
				layout:'fit',
			
				//useArrows: true,//使用vista箭头
				//enableDD: true,//允许拖曳操作
				//root : root,
				split : true,
				hrefTarget : 'center',
				containerScroll: true,
				autoScroll:true,
				listeners : 
				{
					click : function(n) 
					{
						var url = n.attributes.url;
						var id = n.attributes.id;//id 如果没有定义，则自动生成一个唯一的 ID
						var pid = 'panel_'+id;
						var p = center.getItem(pid);//获取节点 ID 对应的标签面板
						//alert(url);
						//alert(url!=null);
						
						if(url!="null"&&url!=null&&url!="undefined")
						{
							if(p)
							{
								//如果已经存在，则激活
								//center.doLayout(); 
								center.setActiveTab(p);
							}
							else
							{
								//如果不存在，则创建新的并激活
								p = new Ext.Panel({
									title: n.attributes.text,
									autoLoad: {url: url, scripts: true},
									closable: true,//标签上出现关闭按钮
									id: pid //这里一定要设置
								
									});
								center.add(p);
								center.setActiveTab(p);
							
								center.doLayout(); 
							}
						}
					}
				}
				
			});
		left.setRootNode(root_logtype);
						
	
	center = new Ext.TabPanel({
			region : 'center',
			enableTabScroll: true,
			autoScroll:true,
			bodyStyle :'overflow-x:visible;overflow-y:scroll',
			containerScroll: true,
 			width:700,    
			height: 300,   
			activeTab:0,   
			 frame:true,
			 defaults:{autoScroll: true}
		});
		var p = new Ext.Panel({
					title: "监控首页",
					autoLoad: {url: "channelInfo.htm", scripts: true},
					//closable: true,//标签上出现关闭按钮
					id: "channelInfoindex" //这里一定要设置
				
			});
		center.add(p);
		center.setActiveTab(p);

		var bottom  =	new Ext.Panel({
			region:'south',
			//margins:'0 0 0 2',
			border:false,
			html:'<div class="menu south">Copyright 2012</div>'	
		
        });
			
			var vp = new Ext.Viewport({
				layout : 'border',
				items : [top, left,center,bottom]
			});
			
			//left.expandAll();
		
	});			
	</script>
  </head>
  
  <body> 
	<%
		if(session.getAttribute("s_userid")==null){
			response.sendRedirect("login.htm");
		}	
	%> 	
  </body>
</html>
